package com.lucweb.service.impl;

import com.lucweb.dao.BuyDao;
import com.lucweb.entity.TaskBuy;
import com.lucweb.entity.TaskMaterial;
import com.lucweb.service.BuyService;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("buyService")
public class BuyServiceImpl implements BuyService {
    @Resource
    private BuyDao buyDao;


    @Override
    public String newbuyTask() {

        return null;
    }

    @Override
    public void saveOrUpdate(TaskBuy taskBuy) {
        buyDao.saveOrUpdate(taskBuy);

    }

    @Override
    public TaskBuy gettaskbuyById(int taskId) {
        return this.buyDao.getbuyById(taskId);
    }

    @Override
    public boolean deletebuytask(int taskId) {
        buyDao.deletebuy(taskId);
        return true;
    }

    @Override
    public List<TaskBuy> showbuy() {
        return this.buyDao.showBuy();
    }

    @Override
    public List<TaskMaterial> showMaterial(int taskId) {

        return this.buyDao.showMaterial(taskId);
    }

    @Override
    public void materialsaveOrUpdate(TaskMaterial taskMaterial) {
        buyDao.materialsaveOrUpdate(taskMaterial);
    }

    @Override
    public TaskMaterial gettaskMaterialById(int materialId) {

        return this.buyDao.getmaterialById(materialId);
    }

    @Override
    public void deletematerialtask(int materialId) {
        buyDao.deletematerial(materialId);
    }

    @Override
    public int getmaxId() {
        return this.buyDao.getmaxId();
    }
}
